<?php
namespace Admin\Model;
use Think\Model;
class OrderModel extends Model 
{
	public function search($pageSize = 3)
	{
		/**************************************** 搜索 ****************************************/
		
		/************************************* 翻页 ****************************************/
		$count = $this->alias('a')->count();
		//var_dump($count);die();
		$page = new \Think\Page($count, $pageSize);
		// 配置翻页的样式
		$page->setConfig('prev', '上一页');
		$page->setConfig('next', '下一页');
		$data['page'] = $page->show();
		/************************************** 取数据 ******************************************/
		$data['data'] = $this->alias('a')->field('a.*,b.goods_id,b.goods_number,b.price,c.goods_name,d.name')->alias('a')
    	                 ->join('left join s50_order_goods b on a.id = b.order_id left join s50_goods c on c.id = b.goods_id left join s50_member d on a.member_id = d.id')
    	                 ->group('a.id')->limit($page->firstRow.','.$page->listRows)->select();
		//var_dump($data);die();
		return $data;
	}
	
}